<script setup>
import {ref} from 'vue';
import router from '@/router';
import { User, Lock, Picture } from '@element-plus/icons-vue';
import smsVerify from "../assets/images/smsVerify.png";

const loginForm = ref({
  username: '',
  password: '',
  verifyCode: '',
  smsVerifyCode: ''
});
function getVerify() {
  return "ok";
}
function login() {
  router.push('/home');
}
</script>
<template>
  <div class="container">
    <el-card shadow="always" :body-style="{ padding: '20px' }" class="login-card">
      <el-text size="large" type="primary" class="login-header">账号登陆</el-text>
      <el-form class="login-form">
        <el-form-item>
          <el-input v-model="loginForm.username" placeholder="请输入用户名" clearable :prefix-icon="User"></el-input>
        </el-form-item>
        <el-form-item>
          <el-input type="password" v-model="loginForm.password" placeholder="请输入密码" clearable :prefix-icon="Lock"></el-input>
        </el-form-item>
        <el-form-item>
          <el-row>
            <el-col :span="15" :offset="0">
              <el-input v-model="loginForm.verifyCode" placeholder="请输入验证码" clearable :prefix-icon="Lock"></el-input>
            </el-col>
            <el-col :span="9" :offset="0">
              <el-button disabled type="primary" @click="getVerify">获取验证码</el-button>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item>
          <el-row>
            <el-col :span="16" :offset="0">
              <el-input v-model="loginForm.smsVerifyCode" placeholder="请输入图形验证码" clearable :prefix-icon="Picture"></el-input>
            </el-col>
            <el-col :span="8" :offset="0">
              <el-image :src="smsVerify" fit="fill" :lazy="true"></el-image>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item>
          <el-row>
            <el-col :span="24" :offset="0">
              <el-button type="primary" size="default" @click="login" class="login-loginbutton">立即登录</el-button>
            </el-col>
          </el-row>
        </el-form-item>
        <router-link to="">
          <el-text size="small" type="primary">忘记密码</el-text>
        </router-link>
      </el-form>
    </el-card>
    
  </div>
</template>

<style lang="scss" scoped>
  .container {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-image: url("@/assets/images/login_bg.png");
    position: relative;
    .login-card {
      position: absolute;
      top: 50%;
      left: 70%;
      transform: translate(-50%, -50%);
      width: 320px;
      height: 360px;
      padding: 10px;
      text-align: center;
      .login-header {
        border-bottom: 3px solid #409EFF; 
        padding-bottom: 5px;
      }
      .login-form {
        margin-top: 30px;
        .login-loginbutton {
          width: 280px;
        }
      }
    }
  }
</style>